# -*- coding: utf-8 -*-
import scrapy
from ..items import MeiziImgItem


class MeiziSpider(scrapy.Spider):
    name = 'meizi'
    allowed_domains = ['mmonly.cc']

    def start_requests(self):
        for i in range(45):
            yield scrapy.Request('https://m.aitaotu.com/tag/siwa/' + str(i) + '.html', callback=self.parse)

    def parse(self, response):
        for block in response.css("#listcon ul li"):
            item = MeiziImgItem()
            item['image_urls'] = block.xpath("./div/a/img/@data-original").getall()
            yield item
